// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import FastClick from 'fastclick'
import App from './App.vue'
import router from './router'
import { WechatPlugin } from 'vux'
import 'weui/dist/style/weui.min.css'
Vue.use(WechatPlugin)

import { webHttp } from './galaxy/index.js'

webHttp.post('/WeChatApi/getConfig', {
  'url': window.location.href
}).then(function (response) {
  var config = response.data.result
  console.log(config)
  Vue.wechat.config({
    debug: false,
    appId: config.appId,
    timestamp: config.timestamp,
    nonceStr: config.nonceStr,
    signature: config.signature,
    jsApiList: [
      'scanQRCode',
      'chooseImage',
      'uploadImage',
      'downloadImage'
    ]
  })
}).catch(function (response) {
  console.log(response)
})

Vue.wechat.error(function (res) {
  console.log(JSON.stringify(res))
})

FastClick.attach(document.body)

Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app-box',
  router,
  template: '<App/>',
  components: { App }
})

